package utils

import "time"

func BirthdayToAge(birthday time.Time) int {
	if birthday.Year() < 1000 {
		return 0
	}
	yers := time.Now().Year() - birthday.Year()
	if time.Now().Month() < birthday.Month() || (time.Now().Month() == birthday.Month() && time.Now().Day() < birthday.Day()) {
		yers--
	}
	if yers < 0 {
		yers = 0
	}
	return yers
}
